﻿using mckfrpc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace mck.frpc
{
    static class Program
    {
        private static System.Threading.Mutex mutex;
        public static string frpName = "frpc";

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (frpName == "frpc")
            {
                mutex = new System.Threading.Mutex(true, "mckfrpc");
            }
            else
            {
                mutex = new System.Threading.Mutex(true, "mckfrps");
            }


            if (mutex.WaitOne(0, false))
            {
                if (frpName == "frpc")
                {
                    Application.Run(new mckfrpc.frpc());
                }
                else
                {
                    Application.Run(new frps());
                }
            }
            else
            {
                MessageBox.Show("程序已经在运行！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }

        }
    }
}
